// index.js
Page({

  onLoad(){
    this.getCode();
  },
  data: {
    wxUnlimitCodeUrl: '',
    wxlimitCodeUrl: '',
    wxQRlimitCodeUrl: '',
  },
  
  getCode() {
    if (this.data.isLoading) {
      return;
    }

    this.setData({
      isLoading: true,
      errorMessage: ''
    });

    wx.request({
      url: 'http://127.0.0.1:8080/qr/getlimitCode',
      method: 'GET',
      timeout: 10000, // 10秒超时
      success: (res) => {
        if (!res.data.data) {
          console.log("数据错误")
        }          
        console.log(res.data.data)
        let base64 = res.data.data
        console.log(base64)
        this.setData({
          wxlimitCodeUrl: base64
        });
      }
    });

    wx.request({
      url: 'http://127.0.0.1:8080/qr/getUnlimitCode',
      method: 'GET',
      timeout: 10000, // 10秒超时
      success: (res) => {
        if (!res.data.data) {
          console.log("数据错误")
        }          
        let base64 = res.data.data
        console.log(base64)
        this.setData({
          wxUnlimitCodeUrl: base64
        });
      }
    });


    wx.request({
      url: 'http://127.0.0.1:8080/qr/getQRlimitCode',
      method: 'GET',
      timeout: 10000, // 10秒超时
      success: (res) => {
        if (!res.data.data) {
          console.log("数据错误")
        }          
        console.log(res.data.data)
        let base64 = res.data.data
        console.log(base64)
        this.setData({
          wxQRlimitCodeUrl: base64
        });
      }
    });

  }

});
